#include "progressBar.h"
#include <unistd.h>
#include <cstring>
#define NONE "\033[m"
#define RED "\033[0;32;31m"
#define LIGHT_RED "\033[1;31m"
const char* lable="/-\\|";
char bar[NUM];
void progressbar(int speed)
{
     Initbar();
     size_t len=strlen(lable);
     for(int i=0;i<=TOP;)
     {
         printf(LIGHT_RED "[%-100s]" NONE RED "[%d%%] [%c]\r" NONE,bar,i,lable[i%len]);
          fflush(stdout);
          bar[i]=body;
          i++;
          if(i!=TOP)
          {  
          bar[i]='>';
          }
          usleep(speed);       
     }
     fflush(stdout);
     printf("\n");;
}
void Initbar()
{
    memset(bar,'\0',sizeof(bar));
}
